import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import router from "./router/index";
import './assets/css/global.less';
import '../src/assets/iconfont/iconfont.css';
import 'element-ui/lib/theme-chalk/display.css';

import VueI18n from 'vue-i18n'
import Meta from "vue-meta";
Vue.use(Meta);
Vue.use(VueI18n)
Vue.config.productionTip = false
Vue.use(ElementUI)
import BaiduMap from 'vue-baidu-map'
Vue.use(BaiduMap,{ak:'0N7UwqrhPQPqC1cbQhLfoUNntuHhocfv'})
const i18n = new VueI18n({ 
 locale: 'ch', // 定义默认语言为中文 
 messages: {   
    'ch': require('@/language/ch.json'),   
    'en': require('@/language/en.json') 
  }
});
import wxlogin from "vue-wxlogin";
Vue.component("my-component", {
  components: {
    wxlogin,
  },
});
var EvuentBus = new Vue();
Object.defineProperties(Vue.prototype, {
  $bus: {
    get: function () {
      return EvuentBus;
    }
  }
})
router.afterEach((to, from) => {
  // 每次进入路由都会触发
  if (window._hmt) {
    if (to.path) {  
        window._hmt.push(['_trackPageview', '/#' + to.fullPath]); // 如果不是根路径，需要指定第二个参数的路径
    }
  }
});

router.afterEach((to,from,next) => {
  window.scrollTo(0,0);
});

new Vue({
  router,
  i18n,
  render: h => h(App),
}).$mount('#app')
